public class MyGz {
    int x;

    public MyGz(int y){
        System.out.println("构造函数MyGz");
        x = y;
    }                                   //输出“构造函数MyGz”

    public static void main(String[] args){
        MyGz myObj = new MyGz(5);       //调用构造函数
        System.out.println(myObj.x);
    }                                      //输出5
}
